//
//  StrategyCollectionViewCell.m
//  ITrip
//
//  Created by dllo on 15/5/22.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "StrategyCollectionViewCell.h"
#import <UIImageView+AFNetworking.h>
@implementation StrategyCollectionViewCell

- (void)dealloc
{
    [self.name_zh_cn_label release];
    [self.name_en_label release];
    [self.countLabel release];
    [self.imageview release];
    [self.countView release];
    [super dealloc];
}

- (void)setStrategyModel:(StrategyModel *)strategyModel
{
    self.name_zh_cn_label.text = strategyModel.name_zh_cn;
    self.name_en_label.text = strategyModel.name_en;
    NSString *str = @"旅行地";
    self.countLabel.text = [str stringByAppendingFormat:@"%ld", strategyModel.poi_count];
    [self.imageview setImageWithURL:[NSURL URLWithString:strategyModel.image] placeholderImage:nil];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createMyView];
    }
    return self;
}

- (void)createMyView
{
    self.imageview = [[UIImageView alloc]init];
    [self.contentView addSubview:self.imageview];
   
    self.name_zh_cn_label = [[UILabel alloc]init];
    [self.imageview addSubview:self.name_zh_cn_label];
    
    self.name_en_label = [[UILabel alloc]init];
    [self.imageview addSubview:self.name_en_label];
    
    self.countView = [[UIView alloc]init];
    [self.imageview addSubview:self.countView];
    
     self.countLabel = [[UILabel alloc]init];
    [self.imageview addSubview:self.countLabel];

    [self.name_zh_cn_label release];
    [self.name_en_label release];
    [self.countLabel release];
    [self.imageview release];
    [self.countView release];
    
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.imageview.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height);
    self.imageview.backgroundColor = [UIColor grayColor];
    
    self.name_zh_cn_label.frame = CGRectMake(5, 5, 120, 30);
    self.name_zh_cn_label.backgroundColor = [UIColor clearColor];
    self.name_zh_cn_label.textColor = [UIColor whiteColor];
    self.name_zh_cn_label.font = [UIFont boldSystemFontOfSize:20];
    
    self.name_en_label.frame = CGRectMake(5, 30, 120, 30);
    self.name_en_label.backgroundColor = [UIColor clearColor];
    self.name_en_label.font = [UIFont systemFontOfSize:15];
    self.name_en_label.textColor = [UIColor whiteColor];
    
    self.countView.frame = CGRectMake(30, 180, 90, 25);
    self.countView.backgroundColor = [UIColor blackColor];
    self.countView.alpha = 0.4;
    self.countView.layer.cornerRadius = 10;
    self.countView.layer.masksToBounds = YES;
    
    self.countLabel.frame = CGRectMake(30, 180, 90, 25);
    self.countLabel.font = [UIFont systemFontOfSize:13];
    self.countLabel.textAlignment = NSTextAlignmentCenter;
    self.countLabel.textColor = [UIColor whiteColor];
    self.countLabel.font = [UIFont boldSystemFontOfSize:14];
    
    
}


@end
